package com.hqyj.lyf.controller;

import com.hqyj.lyf.pojo.ExamPaper;
import com.hqyj.lyf.service.ExamPaperService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author Qiuluoer
 *  2022/5/30 14:14
 */
@Controller
@RequestMapping("/expa")
public class ExamPaperController {
    @Autowired
    ExamPaperService examPaperService;

    @PostMapping("/addex")
    @ResponseBody
    public Map<String,Object> addExamPaper(@RequestBody  Map<String, Object> data){
    //public Map<String,Object> addExamPaper(@RequestBody Map<String,Object> map){
        //String examPaperName = (String)map.get("examPaperName");
       // List quIds =(List)map.get("quIds");

        System.out.println(data.get("quIds"));
        System.out.println(data.get("examPaperName"));
        //System.out.println(quIds);
        Map<String, Object> map1 = examPaperService.addExamPaper((String)data.get("examPaperName"), (List)data.get("quIds"));
        return map1;
    }
    @RequestMapping("/byex")
    @ResponseBody
    public Map<String,Object> queryByExamPaper(ExamPaper examPaper){
        Map<String, Object> map = examPaperService.queryByExamPaper(examPaper);
        return map;
    }

    @RequestMapping("/quallex")
    @ResponseBody
    public Map<String,Object> queryAllExamPaper(){
        Map<String, Object> map = examPaperService.queryAllExamPaper();
        return map;
    }

    @RequestMapping("/delex")
    @ResponseBody
    public Map<String,Object> deleteExamPaper(List<Integer> examIds){
        Map<String, Object> map = examPaperService.deleteExamPaper(examIds);
        return map;
    }
}
